// store/Counter.ts
import {action, makeObservable, observable} from 'mobx'
class MobxData {
  constructor(){
    // 参数1：target，把谁变成响应式（可观察）
    // 参数2：指定哪些属性或者方法变成可观察
    makeObservable(this, {
       count: observable,
       width: observable, //侧边栏宽度
       increment: action,
       decrement: action,
       reset: action,
     })
  }
  count = 1
  width = 90
  increment(){
    this.count++
  }
  decrement(){
    this.count--
  }
  reset(){
    this.count = 0
  }

  setWidth(v:number){
    this.width = v;
  }
}
const mobxData = new MobxData()
export default mobxData